******************************************************************************************
** Replication Code for																	**
** Large-scale agricultural investments, employment opportunities and communal conflict **
** Alexander De Juan, Lisa Hoffmann, Jann Lay											**
** Final version, November 1, 2023														**
******************************************************************************************

set scheme plotplain // thanks to Daniel Bischof

********************************************************************************
************************* prepare data for analysis ****************************
********************************************************************************

**************
*** sample ***
**************
gen village_out_sample=(dist_m_plant>1580 & dist_m_plant<2580 & region==1) | (dist_m_plant>7580 & region==1) | (dist_m_plant>2000 & dist_m_plant<3000 & region==2) | (dist_m_plant>8000 & region==2) // identify villages that do not meet criteria of original sampling plan
drop if townid==225 // drop outlier village (artificially extended to host plantation employees) 

*************************
*** village treatment ***
*************************

* generate town distance to plantation relative to treatment cutoff
gen dist_m_plant_relative=.
replace dist_m_plant_relative=dist_m_plant-1580 if region==1
replace dist_m_plant_relative=dist_m_plant-2000 if region==2
gen dist_m_plant_km=dist_m_plant/1000

* generate binary treatment variable based on distance cutoff
gen treatment_clean= (dist_m_plant_relative<0) if dist_m_plant_relative!=.

* generate treatment in more conservative sample: censor sample to closest 20 villages on both sides of the treatment cutoff 
gen treatment_clean_limited=. 
replace treatment_clean_limited=0 if dist_m_plant_relative>0 & dist_m_plant_relative<=3360
replace treatment_clean_limited=1 if dist_m_plant_relative<0 & dist_m_plant_relative>=-1141 

*********************
*** JDG treatment ***
*********************

gen thinks_same_tribe=(((ethnicity1== ethnicity) & order==1) | ((ethnicity2==ethnicity) & order==2)) // create variable indicating subjective identification of partners' ethnic identity in jdg
gen playerchief_partnerchief=(ethnchief==1 & partner==1) if ethnchief!=. & partner!=. // player and partner belong to chief group 
gen playernonchief_partnernonchief=(ethnchief==0 & partner==0) if ethnchief!=. & partner!=. // player and partner belong to non-chief group 
gen playerchief_partnernonchief=(ethnchief==1 & partner==0) if ethnchief!=. & partner!=. // player belongs to chief group partner belongs to non-chief group 
gen playernonchief_partnerchief=(ethnchief==0 & partner==1) if ethnchief!=. & partner!=. // player belongs to non-chief group partner belongs to chief group
gen mixed_ethnic_game= (playerchief_partnernonchief==1 | playernonchief_partnerchief==1) if ethnchief!=. & partner!=. // identify any mixed ethnic constellation in games

******************
*** covariates ***
******************

gen protest_yn=(m2>0) if m2!=. // identify individuals that have protested or would be willig to protested
gen noEPOSDhh=(EPOSDhh==0) if EPOSDhh!=. // identify individuals living in households without any LSAI employment
gen not_elected=(chief_elected==0) if chief_elected!=. // respondents living in towns in which chief has not been elected
gen ln_hh_income =ln(1+ HHinc_total_mth) // log-transformed household income
gen over_50_sign=(cansign==1) if age>49 & migrated==0 // people older than 50, born in town, that are unable to sign
gen ln_plotsize=ln(1+plotsize) // log-transformed size of owned land
gen migrated_last_year=(s6_migration<=1) // migrated to town within last year
gen landloss_last_year=(years_land_loss <=1) // has lost land within last year
gen migrated_job =(migrated_reason==1) // migrated for job reasons 
gen migrated_jobs_last_year=(migrated_job==1 & s6_migration<=1) // has migrated to town for job reasons within last year
gen migrated_jobs_recent=(migrated_job==1 & recently_migrated==1) // has migrated to town for job reasons within last 10 years
egen rcount_village_violence = rcount(conflicts_consequences1-conflicts_consequences6 conflicts_landconsequences1-conflicts_landconsequences6 conflicts_workconsequences1-conflicts_workconsequences6 ///
conflicts_ethnicconsequences1-conflicts_ethnicconsequences6 conflicts_religionconsequences1-conflicts_religionconsequences6 conflicts_otherconsequences1-conflicts_otherconsequences6 ), c(@>1 & @<5)
gen village_violence_binary =(rcount_village_violence>0) // identify villages that experience at least one instance of violence

********************************************************
*** dummy variables for fixed effects specifications ***
********************************************************

tab region, gen(region_dum_) // plantation region (Sime Darby vs EPO)
tab cluster, gen(cluster_dum_) // geographical clusters
tab ethnicity, gen(tribe_dum_) // tribes
tab order, gen(order_dum) // order in JDG
rename tribe_dum_9 c_tribe_dum_9 //always leaving same tribe out

*************************************
*** plantation exposure over time ***
*************************************

egen sum_landloss_year_treat=total(landlost), by(years_land_loss) // amount of land lost in full sample per year
gen years_near_plantation=plantation_startdate // identify year that plantation came close to village
gen proximity_plantation=(years_near_plantation!=.) // identify individuals that live close to plantation
egen sum_proximity_plantation_treat=total(proximity_plantation), by(years_near_plantation) // count number of respondents that have been close to plantatio per year
egen sum_job_migrants_year_treat=total(migrated_job), by(s6_migration) // number of job-related migrations per year
egen sum_migrants_year_treat=total(migrated), by(s6_migration) // number of all migrations per year

****************************
*** Label main variables ***
****************************

label var prc "Precipitation (vill)"
label var rdt "Radiation (vill)"
label var slope "Slope (vill)"
label var tmp "Temperature (vill)"
label var wnd "Wind (vill)"
label var pop "Population (vill)"
label var age "Age (hh)"
label var treatment_clean "Plantation (y/n)"
label var treatment_clean_limited "Plantation (y/n) | limited sample"
label var dist_m_plant_km "Plantation (distance)"
label var destr "JDG money destroyed (amount)"
label var prop "JDG money destroyed (y/n)"
label var landlost "Lost land (hh)"
label var EPOSDhh "Plantation employment (hh)"
label var v_employment "Plantation workers (vill)"
label var male "Gender male (hh)"
label var secret_assoc "Secret association (vill)"
label var dum_war_exposure "War exposure (hh)"
label var chief_elected "Chief elected (vill)"
label var tribal "Tribal certificate (vill)"
label var recently_migrated "Migrated (hh)"
label var long_migrated "Migrated long (hh)"
label var ethnchief "Chief group (hh)"
label var ln_hh_income "Total income (hh, log)"
label var over_50_sign "Can sign (hh)"
label var village_violence_binary "Violent conflict (y/n, vill)"
label var c7 "Violence justified (hh)"
label var village_lat "Latitude (vill) (randomized)"
label var village_long "Longitude (vill) (randomized)"
label var t3 "Support inter-ethnic marriage (hh)"
label var mixed_ethnic_game "Mixed ethnic constellation"
label var playernonchief_partnerchief "Player non-chief group vs. partner chief group"
label var playerchief_partnernonchief "Player chief group vs. partner non-chief group"
labvarch tribe_dum_*, suffix(" (hh)")
labvars interv1 interv2 interv3 c_interv4 "Interviewer 1" "Interviewer 2" "Interviewer 3" "Interviewer 4"

***************************
*** Define value labels ***
***************************

label define treatment_clean 0 "LSAI control" 1 "LSAI treatment"
label values treatment_clean treatment_clean
label define ethnchief 0 "Player non-chief" 1 "Player chief", replace
label values ethnchief ethnchief
label define partner 0 "Partner non-chief" 1 "Partner chief", replace
label values partner partner
label define thinks_same_tribe 0 "Other ethnicity" 1 "Same ethnicity", replace
label value thinks_same_tribe thinks_same_tribe

************************************************
*** Prepare and label standardized variables ***
************************************************

* divide explanatory variables by twice their SD to make effect sizes comparable to those of binary variables; Gelman (2008): Scaling regression inputs by dividing by two standard deviations
foreach i in prc rdt slope tmp wnd dist_m_plant_km pop village_long village_lat age ln_plotsize plotsize p18 {
 egen `i'_sd  =sd(`i')
 gen std_`i'=`i'/(2*`i'_sd)
 }
drop *_sd
 
* label standardized variables
label var std_prc "Precipitation (vill)"
label var std_rdt "Radiation (vill)"
label var std_slope "Slope (vill)"
label var std_tmp "Temperature (vill)"
label var std_wnd "Wind (vill)"
label var std_pop "Population (vill)"
label var std_age "Age (hh)"
label var std_village_lat "Latitude (vill) (randomized)"
label var std_village_long "Longitude (vill) (randomized)"

**********************************
*** define controls/covariates ***
**********************************

global interviewer interv1 interv2 interv3
global individual age male tribe_dum_*
global pretreatment slope pop secret_assoc tribal chief_elected
global covariates prc slope tmp rdt wnd village_long village_lat over_50_sign dum_war_exposure pop secret_assoc tribal chief_elected
global balance_plant_vill std_prc std_rdt std_slope std_tmp std_wnd std_pop std_village_long std_village_lat secret_assoc tribal chief_elected
global balance_plant_hh over_50_sign dum_war_exposure tribe_dum_1 tribe_dum_2 tribe_dum_8 c_tribe_dum_9 

* identify observations with missings in covariates
egen miss_covariates=rowmiss($interviewer $individual $pretreatment)

*************************************************
*** descriptive statistics and power analysis ***
*************************************************

***TABLE A1***
estpost summarize destr prop EPOSDhh treatment_clean dist_m_plant_km age male tribe_dum_1 tribe_dum_2 tribe_dum_8 c_tribe_dum_9 $covariates  
esttab using tb_a1.tex, compress varwidth(30) cells("mean(fmt(3)) min(fmt(3)) max(fmt(3)) sd(fmt(3)) count(fmt(0))") noobs nonumber label title("Summary statistics (both JDG rounds)") replace  
eststo clear

**Power analysis***
power twomeans 0.2081181, power(0.8) n(1000 1961 2000) sd(0.3086706) graph(y(delta)) //effect size of 3.9 percentage points if we assume n=1,961
power twomeans 0.2411727, power(0.8) n(500 507 520) sd(0.322303) graph(y(delta)) //effect size of 8 percentage points if we assume n=507

**************************************
*** validating the outcome measure ***
**************************************

****TABLE B1 - associations between village-level/individual-level measures of violence and JDG-outcomes****
xtset townid
eststo: reg prop village_violence_binary $interviewer $individual if order==1,  r cluster(townid)
eststo: reg prop village_violence_binary $interviewer $individual $balance_plant_vill if order==1,  r cluster(townid)
eststo: xtreg prop c7 $interviewer $individual if order==1, fe r cluster(townid)
eststo: xtreg prop c7 $interviewer $individual if order==1 & end2==0, fe r cluster(townid)
esttab using tb_b1.tex, label replace nomtitles star(+ 0.10 * 0.05 ** 0.01 *** 0.001) scalars(r2) se ///
indicate("Individual controls=$individual" "Interviewer controls=$interviewer" "Village controls=$balance_plant_vill") nonotes 
eststo clear

****TABLE B2 - associations between self-reported support for inter-ethnic marriage and JDG-outcomes****
eststo: xtreg prop t3 $interviewer $individual if order==1 & mixed_ethnic_game==0, fe r cluster(townid)
eststo: xtreg prop t3 $interviewer $individual if order==1 & playerchief_partnernonchief==1, fe r cluster(townid)
eststo: xtreg prop t3 $interviewer $individual if order==1 & playernonchief_partnerchief==1, fe r cluster(townid)
eststo: xtreg prop t3 $interviewer $individual if order==1 & playernonchief_partnerchief==1 & end2==0, fe r cluster(townid)
esttab using tb_b2.tex, label replace nomtitles star(+ 0.10 * 0.05 ** 0.01 *** 0.001) scalars(r2) se ///
indicate("Individual controls=$individual" "Interviewer controls=$interviewer") nonotes 
eststo clear

********************************
*** validating the treatment ***
********************************

****FIGURE 3 - association between distance to plantation and employment on plantation****
binscatter EPOSDhh dist_m_plant_relative, line(connect) xline(0, lpattern(dash)) discrete msymbols(smcircle) lcolors(gs10) mcolors(gs1) ///
ytitle("Employment (hh)", size(large)) xtitle(" ") ylab(0(0.1)1, labsize(large)) xlabel(, labsize(large)) saving(emp, replace)
binscatter v_employment_plantation dist_m_plant_relative, line(connect) xline(0, lpattern(dash)) discrete msymbols(smcircle) lcolors(gs10) mcolors(gs1) ///
ytitle("Employment (vill)", size(large)) xtitle(" ") ylab(0(10)100, labsize(large)) xlabel(, labsize(large)) saving(emp_vill, replace)
graph combine emp.gph emp_vill.gph, col(1) xcommon
graph display, ysize(4) xsize(6) scale(0.7) 
graph export "fg3.eps", replace

****FIGURE C1 - correlation between treatment and employment on plantation with varying maximum distances to plantation****
forvalues i= 2000(1000)8000 {
 eststo: reg EPOSDhh treatment_clean $interviewer $individual if order==1 & dist_m_plant_relative<`i', r cluster(townid)
 }
coefplot (est1, aseq("2km") \ est2, aseq("3km") \ est3, aseq("4km") \ est4, aseq("5km") \ est5, aseq("6km") \ est6, aseq("7km")), keep(treatment_clean) ///
yline(0, lpattern(solid)) ylabel(, labsize(small)) xlabel(, labsize(small) )  subtitle("") legend(size(small) position(6) cols(2))  aseq swapnames legend(off) vertical ///
title("Maximum extent of control group") saving(emp_distances, replace) 
estimates clear
graph export "fg_c1.eps", replace

****FIGURE 4 - correlation between treatment and other proximate effects of the plantation****
eststo: reg EPOSDhh treatment_clean $interviewer $individual if order==1, r cluster(townid) 
eststo: reg landlost treatment_clean $interviewer $individual if order==1, r cluster(townid)
eststo: reg landloss_last_year treatment_clean $interviewer $individual if order==1, r cluster(townid)
eststo: reg recently_migrated treatment_clean $interviewer $individual if order==1, r cluster(townid)
eststo: reg migrated_last_year treatment_clean $interviewer $individual if order==1, r cluster(townid)
eststo: reg migrated_jobs_recent treatment_clean $interviewer $individual if order==1, r cluster(townid)
eststo: reg migrated_jobs_last_year treatment_clean $interviewer $individual if order==1, r cluster(townid)
eststo: reg std_p18 treatment_clean $interviewer $individual if order==1, r cluster(townid)
eststo: reg protest_yn treatment_clean $interviewer $individual if order==1, r cluster(townid)
coefplot (est1, aseq("Plantation employment (hh)") \ est2, aseq("Land loss | 10 years (hh)") \ est3, aseq("Land loss | last year (hh)") \ est4, aseq("Migrated | 10 years (hh)") \ est5, aseq("Migrated | last year (hh)") \ est6, aseq("Migrated jobs | 10 years (hh)") \ est7, aseq("Migrated jobs | last year (hh)") \ est8, aseq("Promises fullfilled (hh)") \ est9, aseq("Protest | last year (hh)")), ///
keep(treatment_clean) xline(0, lpattern(solid)) legend(position(6) cols(2)) title("") aseq swapnames eqrename(* = "") legend(off) xline(.2238646)
graph export "fg4.eps", replace
eststo clear

************************************
*** assess pre-treatment balance *** 
************************************

****FIGURE 5 estimate correlations between pre-treatment covariates and plantation treatment - set boundaries for equivalence test at size of treatment effct on EPOSDhh (incl. cluster FE)****
foreach i in EPOSDhh $balance_plant_vill $balance_plant_hh   {
 reg `i'  treatment_clean if order==1, r cluster(townid) 
 estimates store fu_`i'
 }
 foreach i in EPOSDhh $balance_plant_vill $balance_plant_hh   {
 reg `i'  treatment_clean i.cluster if order==1, r cluster(townid) 
 estimates store li_`i'
 }
coefplot (fu_*, label("Bivariate") mcolor(black) ciopts(color(black))) (li_*, label("Cluster fixed effects") mcolor(gs12) ciopts(color(gs12))), ///
drop(*cluster _cons) xline(0, lpattern(solid)) legend(position(6) cols(2)) title("") eqrename(fu_* = "" li_* = "") ///
groups($balance_plant_vill = "{bf:Village}"  $balance_plant_hh = "{bf:Household}", angle(vertical)) aseq swapnames xline(.2314251) xline(-.2314251)
graph display, ysize(10) xsize(10) scale(0.7) 
graph export "fg5.eps", replace
estimates clear

****FIGURE C2 - estimate correlations between pre-treatment covariates and JDG treatment****
foreach i in $balance_plant_vill $balance_plant_hh {
 quietly reg `i' partnerchieftribe if order==1, r  
 estimates store r1_`i'
 }
 foreach i in $balance_plant_vill $balance_plant_hh {
 quietly reg `i' partnerchieftribe if order==2, r 
 estimates store r2_`i'
 }
coefplot (r1_*, label("JDG round 1") mcolor(black) ciopts(color(black))) (r2_*, label("JDG round 2") mcolor(gs12) ciopts(color(gs12))), ///
drop(_cons) xline(0) legend(position(6) cols(2)) title("")  eqrename(r1_* = "" r2_* = "") ///
groups($balance_plant_vill = "{bf:Village}"  $balance_plant_hh = "{bf:Household}", angle(vertical)) aseq swapnames xsc(r(-.3 .3) extend) xline(.2314251) xline(-.2314251) xlabel(-.3 (.1) .3)
graph display, ysize(10) xsize(10) scale(0.7) 
graph export "fg_c2.eps", replace
estimates clear

********************************************************************************
********************************* main analyses ********************************
********************************************************************************

****FIGURE A1 - detailed JDG outcomes in treatment and control villages**** 
hist destroy, by(treatment_clean, note("")) discr percent 
graph export "fg_a1.eps", replace

****FIGURE 6 - bivariate relationships****
binscatter prop dist_m_plant_relative if order==1, line(connect) xline(0) discrete msymbols(smcircle) lcolors(gs10) mcolors(gs1) ytitle("Money destroyed (y/n)") xtitle(" ")
addplot: function first=.5210843, ra(-2000 0) || function second=.3585492, ra(0 7000) ylab(0(0.2)1)
graph display, ysize(4) xsize(6) scale(0.7) 
graph export "fg6.eps", replace

****TABLE 1 - money destroyed****
eststo: reg prop treatment_clean cluster_dum* if order==1, r cluster(townid) 
eststo: reg prop treatment_clean cluster_dum* $interviewer if order==1, r cluster(townid)
eststo: reg prop treatment_clean cluster_dum* $interviewer $individual if order==1, r cluster(townid)
eststo: reg prop treatment_clean cluster_dum* $interviewer $individual $pretreatment if order==1, r cluster(townid)
eststo: reg prop treatment_clean_limited cluster_dum* $interviewer $individual $pretreatment if order==1, r cluster(townid)
eststo: reg prop dist_m_plant_km cluster_dum* $interviewer $individual $pretreatment if order==1, r cluster(townid)
esttab using tb1.tex, label replace nomtitles star(+ 0.10 * 0.05 ** 0.01 *** 0.001) scalars(r2) se ///
indicate("Individual controls=$individual" "Pretreatment controls=$pretreatment" "Interviewer FE=$interviewer"  "Cluster FE=cluster_dum*") nonotes 

****TABLE C2 - full table for appendix****
esttab using tb_c2.tex, label replace nomtitles star(+ 0.10 * 0.05 ** 0.01 *** 0.001) scalars(r2) se ///
order(treatment_clean treatment_clean_limited dist_m_plant_km $individual $pretreatment) ///
indicate("Interviewer FE=$interviewer"  "Cluster FE=cluster_dum*") nonotes 
eststo clear

****TABLE C1 - money destroyed / subsample: no missing values, only villages closest to distance threshold (20 villages on each side of the cutoff)**** 
eststo: reg prop treatment_clean cluster_dum* if order==1 & miss_covariates==0 & treatment_clean_limited!=., r cluster(townid) 
eststo: reg prop treatment_clean cluster_dum* $interviewer if order==1 & miss_covariates==0 & treatment_clean_limited!=., r cluster(townid)
eststo: reg prop treatment_clean cluster_dum* $interviewer $individual if order==1 & miss_covariates==0 & treatment_clean_limited!=., r cluster(townid)
eststo: reg prop treatment_clean cluster_dum* $interviewer $individual $pretreatment if order==1 & miss_covariates==0 & treatment_clean_limited!=., r cluster(townid)
eststo: reg prop dist_m_plant_km cluster_dum* $interviewer $individual $pretreatment if order==1 & miss_covariates==0 & treatment_clean_limited!=., r cluster(townid)
esttab using tb_c1.tex, label replace nomtitles star(+ 0.10 * 0.05 ** 0.01 *** 0.001) scalars(r2) se ///
indicate("Individual controls=$individual" "Pretreatment controls=$pretreatment" "Interviewer FE=$interviewer"  "Cluster FE=cluster_dum*") nonotes 
eststo clear

************************************************************************
*** effects of plantatation treatment on local conflict - robustness ***
************************************************************************

****TABLE C3 - logit models****
eststo: logit prop treatment_clean cluster_dum* if order==1, r cluster(townid) 
eststo: logit prop treatment_clean cluster_dum* $interviewer if order==1, r cluster(townid)
eststo: logit prop treatment_clean cluster_dum* $interviewer $individual if order==1, r cluster(townid)
eststo: logit prop treatment_clean cluster_dum* $interviewer $individual $pretreatment if order==1, r cluster(townid)
eststo: logit prop treatment_clean_limited cluster_dum* $interviewer $individual $pretreatment if order==1, r cluster(townid)
eststo: logit prop dist_m_plant_km cluster_dum* $interviewer $individual $pretreatment if order==1, r cluster(townid)
esttab using tb_c3.tex, label replace nomtitles star(+ 0.10 * 0.05 ** 0.01 *** 0.001) scalars(r2) se nodepvars ///
indicate("Individual controls=$individual" "Pretreatment controls=$pretreatment" "Interviewer FE=$interviewer"  "Cluster FE=cluster_dum*") nonotes 
eststo clear

****TABLE C4 - amount of money destroyed****
eststo: reg destr treatment_clean cluster_dum* if order==1, r cluster(townid) 
eststo: reg destr treatment_clean cluster_dum* $interviewer if order==1, r cluster(townid)
eststo: reg destr treatment_clean cluster_dum* $interviewer $individual if order==1, r cluster(townid)
eststo: reg destr treatment_clean cluster_dum* $interviewer $individual $pretreatment if order==1, r cluster(townid)
eststo: reg destr treatment_clean_limited cluster_dum* $interviewer $individual $pretreatment if order==1, r cluster(townid)
eststo: reg destr dist_m_plant_km cluster_dum* $interviewer $individual $pretreatment if order==1, r cluster(townid)
esttab using tb_c4.tex, label replace nomtitles star(+ 0.10 * 0.05 ** 0.01 *** 0.001) scalars(r2) se nodepvars ///
indicate("Individual controls=$individual" "Pretreatment controls=$pretreatment" "Interviewer FE=$interviewer"  "Cluster FE=cluster_dum*") nonotes 
eststo clear

****FIGURE C3 - reducing the maximum distance to the plantation in the control group
forvalues i= 2000(1000)8000 {
 eststo: reg prop treatment_clean $interviewer $individual if order==1 & dist_m_plant_relative<`i', r cluster(townid)
 }
coefplot (est1, aseq("2km") \ est2, aseq("3km") \ est3, aseq("4km") \ est4, aseq("5km") \ est5, aseq("6km") \ est6, aseq("7km") \ est7, aseq("8km")), keep(treatment_clean)  ///
yline(0, lpattern(solid)) ylabel(, labsize(small)) xlabel(, labsize(small) )  subtitle("") legend(size(small) position(6) cols(2))  aseq swapnames legend(off) vertical saving(dest_distance, replace) 
estimates clear
graph export "fg_c3.eps", replace

****FIGURE C4 - remove random selection of 10 percent of villages****
set seed 5192223
forvalues i= 1/20 {
bysort townid: generate random_`i' = runiform()
bysort townid: replace random_`i' = random_`i'[1]
sort random_`i' 
egen random_order_`i'=group(random_`i')
reg prop treatment_clean cluster_dum* $interviewer $individual if order==1 & random_order_`i'>7, r cluster(townid)
estimates store rs_`i'
}
coefplot (*), keep(treatment_clean) ///
yline(0) ylabel(, labsize(medium)) xlabel(, labsize(small))  subtitle("") legend(size(medium) position(6) cols(2)) aseq swapnames legend(off) vertical  
graph display, ysize(5) xsize(10) 
graph export "fg_c4.eps", replace
estimates clear
drop random*

****TABLE C5 - remove villages that do not meet original sampling criteria****
eststo: reg prop treatment_clean cluster_dum* if order==1 & village_out_sample==0, r cluster(townid) 
eststo: reg prop treatment_clean cluster_dum* $interviewer if order==1 & village_out_sample==0, r cluster(townid)
eststo: reg prop treatment_clean cluster_dum* $interviewer $individual if order==1 & village_out_sample==0, r cluster(townid)
eststo: reg prop treatment_clean cluster_dum* $interviewer $individual $pretreatment if order==1 & village_out_sample==0, r cluster(townid)
eststo: reg prop treatment_clean_limited cluster_dum* $interviewer $individual $pretreatment if order==1 & village_out_sample==0, r cluster(townid)
eststo: reg prop dist_m_plant_km cluster_dum* $interviewer $individual $pretreatment if order==1 & village_out_sample==0, r cluster(townid)
esttab using tb_c5.tex, label replace nomtitles star(+ 0.10 * 0.05 ** 0.01 *** 0.001) scalars(r2) se nodepvars ///
indicate("Individual controls=$individual" "Pretreatment controls=$pretreatment" "Interviewer FE=$interviewer"  "Cluster FE=cluster_dum*") nonotes 
eststo clear

****TABLE C6 - correlation between village level plantation employment and JDG behavior****
eststo: reg prop v_employment_plantation cluster_dum* if order==1, r cluster(townid) 
eststo: reg prop v_employment_plantation cluster_dum* $interviewer if order==1, r cluster(townid)
eststo: reg prop v_employment_plantation cluster_dum* $interviewer $individual if order==1, r cluster(townid)
eststo: reg prop v_employment_plantation cluster_dum* $interviewer $individual $pretreatment if order==1, r cluster(townid)
esttab using tb_c6.tex, label replace nomtitles star(+ 0.10 * 0.05 ** 0.01 *** 0.001) scalars(r2) se nodepvars ///
indicate("Individual controls=$individual" "Pretreatment controls=$pretreatment" "Interviewer FE=$interviewer"  "Cluster FE=cluster_dum*") nonotes 
eststo clear

****TABLE C7 - correlation between income and JDG behavior****
eststo: reg prop ln_hh_income cluster_dum* if order==1 , r cluster(townid) 
eststo: reg prop ln_hh_income cluster_dum* $interviewer if order==1 , r cluster(townid)
eststo: reg prop ln_hh_income cluster_dum* $interviewer $individual if order==1 , r cluster(townid)
eststo: reg prop ln_hh_income cluster_dum* $interviewer $individual $pretreatment if order==1 , r cluster(townid)
esttab using tb_c7.tex, label replace nomtitles star(+ 0.10 * 0.05 ** 0.01 *** 0.001) scalars(r2) se nodepvars ///
indicate("Individual controls=$individual" "Pretreatment controls=$pretreatment" "Interviewer FE=$interviewer"  "Cluster FE=cluster_dum*") nonotes 
eststo clear

****TABLE C8 - main models including sampling weights****
eststo: reg prop treatment_clean cluster_dum* if order==1 [pweight=weight], r cluster(townid) 
eststo: reg prop treatment_clean cluster_dum* $interviewer if order==1 [pweight=weight], r cluster(townid)
eststo: reg prop treatment_clean cluster_dum* $interviewer $individual if order==1 [pweight=weight], r cluster(townid)
eststo: reg prop treatment_clean cluster_dum* $interviewer $individual $pretreatment if order==1 [pweight=weight], r cluster(townid)
eststo: reg prop treatment_clean_limited cluster_dum* $interviewer $individual $pretreatment if order==1 [pweight=weight], r cluster(townid)
eststo: reg prop dist_m_plant_km cluster_dum* $interviewer $individual $pretreatment if order==1 [pweight=weight], r cluster(townid)
esttab using tb_c8.tex, label replace nomtitles star(+ 0.10 * 0.05 ** 0.01 *** 0.001) scalars(r2) se nodepvars ///
indicate("Individual controls=$individual" "Pretreatment controls=$pretreatment" "Interviewer FE=$interviewer"  "Cluster FE=cluster_dum*") nonotes 
eststo clear

****FIGURE C5 - sensitivity analysis****
sensemakr prop treatment_clean cluster_dum* $interviewer $individual $pretreatment if order==1, treat(treatment_clean) benchmark(pop) contourplot clim(0 0.1)
graph save "contourplot", replace
sensemakr prop treatment_clean  cluster_dum* $interviewer $individual $pretreatment if order==1, treat(treatment_clean) benchmark(pop) tcontourplot clim(0 0.1)
graph save "tcontourplot", replace
graph combine "contourplot" "tcontourplot", col(2) 
graph display, ysize(5) xsize(10) 
graph export "fg_c5.eps", replace
estimates clear

****TABLE C9 - missing data****
foreach i in age male tribe_dum_1 tribe_dum_2 tribe_dum_3 tribe_dum_4 tribe_dum_5 tribe_dum_6 tribe_dum_7 tribe_dum_8 c_tribe_dum_9 tribe_dum_10 tribe_dum_11 tribe_dum_12 tribe_dum_13 secret_assoc tribal chief_elected   {
gen miss_0_`i'=`i'
replace miss_0_`i'=0 if `i'==.
gen miss_`i'=(`i'==.)
 }
eststo: reg prop treatment_clean cluster_dum* $interviewer $individual $pretreatment if order==1, r cluster(townid)
eststo: reg prop treatment_clean cluster_dum* $interviewer slope pop miss_* if order==1, r cluster(townid) 
esttab using tb_c9.tex, label replace nomtitles star(+ 0.10 * 0.05 ** 0.01 *** 0.001) scalars(r2) se ///
indicate("Individual controls= miss_male $individual" "Pretreatment controls=$pretreatment" "Interviewer FE=$interviewer"  "Cluster FE=cluster_dum*") drop(miss_*) nonotes 
eststo clear
drop miss_*

******************************************
*** effects of constellations in plays ***
******************************************

****FIGURE 7 - bivariate analyses of effects of ethnic constellations**** 
cibar prop if order==1, over1(ethnchief) over2(partner) over3(treatment_clean) graphopts(legend(off) ///
ytitle("money destroyed (y/n)") xtitle(" ") saving(prop, replace))
cibar destroy if order==1, over1(ethnchief) over2(partner) over3(treatment_clean) graphopts(legend(position(6) cols(2))  ///
ytitle("money destroyed (amount)") xscale(titlegap(*20))  saving(dest, replace))
graph combine prop.gph dest.gph, cols(1) xcommon iscale(1)
graph display, ysize(7) xsize(10) scale(0.8) 
graph export "fg7.eps", replace

****TABLE E1 - interaction between plantation treatment and ethnic constellation****
xtset townid
eststo: xtreg prop i.ethnchief##i.partner $interviewer $individual if order==1 & treatment_clean==1, r cluster(townid) fe
eststo: xtreg prop i.ethnchief##i.partner $interviewer $individual if order==1 & treatment_clean==0, r cluster(townid) fe
xtset id
eststo: xtreg prop i.ethnchief##i.partner order_dum* if treatment_clean==1, r cluster(id) fe
eststo: xtreg prop i.ethnchief##i.partner order_dum* if treatment_clean==0, r cluster(id) fe
esttab using tb_e1.tex, label nobaselevels nomtitles replace star(+ 0.10 * 0.05 ** 0.01 *** 0.001) scalars(r2) se nodepvars ///
indicate("Individual controls=$individual" "Interviewer controls=$interviewer" "Round FE=order_dum*") nonotes 
eststo clear

****TABLE E2 - alternative estimation strategy: interaction between plantation treatment and ethnic constellation****
eststo: reg prop i.mixed_ethnic_game##i.treatment_clean cluster_dum* $interviewer $individual $pretreatment if order==1, r cluster(townid)
eststo: reg prop i.playernonchief_partnerchief##i.treatment_clean cluster_dum* $interviewer $individual $pretreatment if order==1, r cluster(townid)
eststo: reg prop i.playerchief_partnernonchief##i.treatment_clean cluster_dum* $interviewer $individual $pretreatment if order==1, r cluster(townid)
esttab using tb_e2.tex, label nobaselevels nomtitles replace star(+ 0.10 * 0.05 ** 0.01 *** 0.001) scalars(r2) se nodepvars ///
indicate("Individual controls=$individual" "Pretreatment controls=$pretreatment" "Interviewer FE=$interviewer"  "Cluster FE=cluster_dum*") nonotes 
eststo clear

***************************************************
*** assessing the role of alternative cleavages ***
***************************************************

****FIGURE F1 - other ethnic groups and migrants - money destruction**** 
xtset townid
foreach i in ethnchief tribe_dum_1 tribe_dum_2 tribe_dum_8 c_tribe_dum_9 thinks_same_tribe recently_migrated {
 reg prop i.`i'##i.treatment_clean cluster_dum* $interviewer $pretreatment age male if order==1, r cluster(townid) 
 estimates store ols_`i'
 }
 foreach i in ethnchief tribe_dum_1 tribe_dum_2 tribe_dum_8 c_tribe_dum_9 thinks_same_tribe recently_migrated {
 xtreg prop i.`i'##i.treatment_clean $interviewer age male if order==1, r cluster(townid) fe
 estimates store olsfe_`i'
 }
coefplot (ols_*, label("OLS")) (olsfe_*, label("OLS village FE")), keep (*#1.treatment_clean) ///
coeflabels(1.tribe_dum_1*="Ethnicity==1" 1.tribe_dum_2*="Ethnicity==2" 1.tribe_dum_8*="Ethnicity==8" 1.c_tribe_dum_9*="Ethnicity==9" ///
1.ethn*="Chief group" 1.thinks*="Same ethnicity" 1.recently*="Migrated", wrap (9)) ///
yline(0) ylabel(, labsize(medium)) xlabel(, labsize(medium) ) vertical subtitle("") legend(size(medium) position(6) cols(2)) 
graph display, ysize(5) xsize(10) 
graph export "fg_f1.eps", replace
estimates clear

****FIGURE F2 - reasons for migration in treatment and control villages****
graph bar if order==1, over(recent_migrated_reason) asyvars  bar(1, color(gs10)) bar(2, color(black)) bar(3, color(gs10)) ///
bar(4, color(gs10)) bar(5, color(gs10)) bar(6, color(gs10)) showyvars by(treatment_clean, note("") legend(off)) bargap(5)
graph export "fg_f2.eps", replace

****TABLE F1 - variation in JDG behavior across reasons for migration****
xtset townid
eststo: xtreg prop i.recent_migrated_reason_simpl $interviewer $individual if order ==1, r cluster(townid) fe 
eststo: reg prop  i.recent_migrated_reason_simpl cluster_dum* $interviewer $individual $pretreatment if order==1 [pweight=weight],  r cluster(townid)
eststo: xtreg destr i.recent_migrated_reason_simpl $interviewer $individual if order ==1, r cluster(townid) fe 
eststo: reg destr  i.recent_migrated_reason_simpl cluster_dum* $interviewer $individual $pretreatment if order==1 [pweight=weight],  r cluster(townid)
esttab using tb_f1.tex, label nobaselevels nomtitles replace star(+ 0.10 * 0.05 ** 0.01 *** 0.001) scalars(r2) se nodepvars ///
indicate("Individual controls=$individual" "Pretreatment controls=$pretreatment" "Interviewer FE=$interviewer"  "Cluster FE=cluster_dum*") nonotes 
eststo clear

*************************************
*** investigating temporal trends ***
*************************************

****FIGURE D1 - trends in plantation proximity, land loss, and migration****
twoway scatteri 0 0 500 0 500 10 0 10, recast(area) color(gs13) || dropline sum_proximity_plantation_treat years_near_plantation if treatment_clean==1, sort msymbol(smcircle) mc(black) lc(black) ///
||, legend(off) ytitle("Respondents reached by LSAI") xtitle("Years to survey in 2019") saving(time_proximity, replace)
twoway scatteri 0 0 100 0 100 10 0 10, recast(area) color(gs13) || dropline  sum_landloss_year_treat years_land_loss if treatment_clean==1 , sort msymbol(smcircle) mc(black) lc(black) ///
||, legend(off) ytitle("Number of land losses") xtitle("Years to survey in 2019") saving(time_landloss, replace)
twoway scatteri 0 0 40 0 40 10 0 10, recast(area) color(gs13) || dropline  sum_job_migrants_year_treat s6_migration if s6_migration<1000 & treatment_clean==1, sort msymbol(smcircle) mc(black) lc(black) ///
||, legend(off) ytitle("Number of migrants") xtitle("Years to survey in 2019") saving(time_migration, replace)
graph combine time_proximity.gph time_landloss.gph time_migration.gph, col(1) xcommon
graph display, ysize(6) xsize(6) scale(0.7) 
graph export "fg_d1.eps", replace